import request from "@/utils/request";

export const getLogin=function (form){
    return request.post('/login',form)
}
export const getMenusList=function (){
    return request.get('/menus');
}
export const getUserList=function (paramsObj){
    return request.get('/users',{ params:paramsObj });
}
//修改用户状态
export const getUserStatus=function (uId,type){
    return request.put(`/users/${uId}/state/${type}`,);
}
//添加用户
export const getAddUserInfo=function (userForm){
    return request.post('users',userForm);
}
//根据id查询用户信息
export const getIDUserInfo=function (uId){
    return request.get(`/users/${uId}`);
}
//编辑用户提交
export const putIDUserInfo=function (uId,editUserInfo){
    return request.put(`/users/${uId}`,editUserInfo);
}
//删除
export const deleteUserInfo=function (uId){
    return request.delete(`/users/${uId}`);
}
//权限管理
export const rightsInfo=function (type){
    return request.get(`/rights/${type}`);
}
//角色管理
export const rolesManage=function (){
    return request.get('/roles');
}
//删除角色指定权限
export const deleteRolesRights=function (role,rightId){
    return request.delete(`roles/${role.id}/rights/${rightId}`)
}
//角色授权
export const setRoles=function (rolesId,rids){
    return request.post(`roles/${rolesId}/rights`,rids)
}
// 分配用户角色
export const submitRolesManage=function (id,rid){
    return request.put( `users/${id}/role`,rid);
}
//商品分类数据列表
export const goodsCategories=function (cateObj){
    return request.get('categories', {params:cateObj})
}
//添加分类
export const addCategories=function (addCate){
    return request.post('categories', addCate);
}
//删除分类
export const deleteCategories=function (id){
    return request.delete(`categories/${id}`);
}
//编辑分类
export const editCategories=function (id,name){
    return request.put(`categories/${id}`,name);
}
